aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/app/dashboard/@modal/(.)preview/[bookmarkId]/page.tsx
blob: 432e7a6c30bcc792f5e8c9758d62d63c387b89b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"use client";

import { useState } from "react";
import { useRouter } from "next/navigation";
import BookmarkPreview from "@/components/dashboard/preview/BookmarkPreview";
import { Dialog, DialogContent } from "@/components/ui/dialog";

export default function BookmarkPreviewPage({
  params,
}: {
  params: { bookmarkId: string };
}) {
  const router = useRouter();

  const [open, setOpen] = useState(true);

  const setOpenWithRouter = (value: boolean) => {
    setOpen(value);
    if (!value) {
      router.back();
    }
  };

  return (
    <Dialog open={open} onOpenChange={setOpenWithRouter}>
      <DialogContent
        className="h-[90%] max-w-[90%] overflow-hidden p-0"
        hideCloseBtn={true}
        onOpenAutoFocus={(e) => e.preventDefault()}
      >
        <BookmarkPreview bookmarkId={params.bookmarkId} />
      </DialogContent>
    </Dialog>
  );
}